Rewriting My Old Pascal Code In C